
// 用户发表文章积分+5
function factory (ArticleModel, UserModel) {
  return function (req, res) {
    var article = new ArticleModel(body = req.body)
    article.save(function (err, art) {
      UserModel.findOne({user: art.autor}, function (err, user) {
        user.integral += 5
        user.article.push(art._id)
        user.save(function (err, user) {
          res.send(art._id)
        })
      })
    })
  }
}

module.exports = factory